//
//  UserListRouter.swift
//  demo
//
//  Created by 刘洪宝 on 2025/2/9.
//

import UIKit

class UserListRouter: UserListRouterProtocol {
    static func createUserListModule() -> UIViewController {
        let view = UserListViewController()
        let presenter = UserListPresenter()
        let interactor = UserListInteractor()
        let router = UserListRouter()
        
        view.presenter = presenter
        presenter.view = view
        presenter.router = router
        presenter.interactor = interactor
        interactor.presenter = presenter
        
        return view
    }
    
    func navigateToUserDetail(from view: UserListViewProtocol?, user: User) {
        // 这里实现导航到用户详情页面的逻辑
        guard let viewController = view as? UIViewController else { return }
        let alert = UIAlertController(title: user.name, message: user.email, preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: "确定", style: .default))
        viewController.present(alert, animated: true)
    }
} 
